package com.dwxt.parabolic.dao;

import com.dwxt.parabolic.entity.Event;
import com.dwxt.parabolic.entity.EventExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EventMapper {
    long countByExample(EventExample example);

    int deleteByExample(EventExample example);

    int deleteByPrimaryKey(String id);

    int insert(Event record);

    int insertSelective(Event record);

    List<Event> selectByExample(EventExample example);

    Event selectByPrimaryKey(String id);

    int updateByExampleSelective(@Param("record") Event record, @Param("example") EventExample example);

    int updateByExample(@Param("record") Event record, @Param("example") EventExample example);

    int updateByPrimaryKeySelective(Event record);

    int updateByPrimaryKey(Event record);

    int countByCompanyIdAndTime(@Param("companyId") String companyId, @Param("date") long date,
                                @Param("type") Integer type, @Param("currentCompanyId") String currentCompanyId);

    @Select("SELECT COUNT(1) FROM `event` e WHERE e.camera_id=#{id,jdbcType=VARCHAR} AND e.create_time>DATE_SUB(NOW(),interval 1 MINUTE);")
    int countByid(@Param("id")String id);
}